package dao

import "gorm.io/gorm"

type Good struct {
	gorm.Model
	Name   string  `gorm:"type:varchar(50);comment:'商品名称'"`
	Price  float64 `gorm:"type:decimal(10,2);comment:'商品价格'"`
	Image  string  `gorm:"type:varchar(255);comment:'商品图片'"`
	Status int8    `gorm:"type:tinyint(1);comment:'商品状态'"`
}

type GoodStock struct {
	gorm.Model
	GoodId int `gorm:"type:int(10);comment:'商品id'"`
	Stock  int `gorm:"type:int(10);comment:'商品库存'"`
}

type GoodStockDetail struct {
	gorm.Model
	StockId int  `gorm:"type:int(10);comment:'库存id'"`
	Type    int8 `gorm:"type:tinyint(1);comment:'变化类型'"`
	Number  int  `gorm:"type:int(10);comment:'变化数量'"`
}

type Cart struct {
	gorm.Model
	GoodId int `gorm:"type:int(10);comment:'商品id'"`
	Number int `gorm:"type:int(10);comment:'购买数量'"`
}

type Order struct {
	gorm.Model
	OrderSn string  `gorm:"type:varchar(50);comment:'订单编码'"`
	Price   float64 `gorm:"type:decimal(10,2);comment:'订单总金额'"`
	Status  int8    `gorm:"type:tinyint(1);comment:'订单状态'"`
}

type GoodOrder struct {
	gorm.Model
	OrderId int `gorm:"type:int(10);comment:'订单id'"`
	GoodId  int `gorm:"type:int(10);comment:'商品id'"`
	Number  int `gorm:"type:int(10);comment:'购买数量'"`
}
